package com.hs.biye.model.reslut;

import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultPage<T>  {
    private Integer code;
    private List<T> data;
    private Long total;
    private Long current;
    private Long pages;
    private String msg;


    public static <T> ResultPage<T> success() {
        ResultPage<T> result = new ResultPage<T>();
        result.code = 0;
        return result;
    }

    public static <T> ResultPage<T> success(List<T> data,Long total,Long current,Long pages) {
        ResultPage<T> result = new ResultPage<>();
        result.code = 0;
        result.total = total;
        result.data = data;
        result.current = current;
        result.pages = pages;
        return result;
    }

    public static <T> ResultPage<T> faile(String msg) {
        ResultPage<T> result = new ResultPage<T>();
        result.code = 1;
        result.msg = msg;
        result.data = null;
        return result;
    }
}